package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.DzbqIndustryinfo;
import com.ruoyi.system.service.IDzbqIndustryinfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;

/**
 * 行业信息Controller
 * 
 * @author tianxingxia
 * @date 2025-02-07
 */
@RestController
@RequestMapping("/system/industryinfo")
public class DzbqIndustryinfoController extends BaseController
{
    @Autowired
    private IDzbqIndustryinfoService dzbqIndustryinfoService;

    /**
     * 查询行业信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:industryinfo:list')")
    @GetMapping("/list")
    public AjaxResult list(DzbqIndustryinfo dzbqIndustryinfo)
    {
        List<DzbqIndustryinfo> list = dzbqIndustryinfoService.selectDzbqIndustryinfoList(dzbqIndustryinfo);
        return success(list);
    }

    /**
     * 导出行业信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:industryinfo:export')")
    @Log(title = "行业信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DzbqIndustryinfo dzbqIndustryinfo)
    {
        List<DzbqIndustryinfo> list = dzbqIndustryinfoService.selectDzbqIndustryinfoList(dzbqIndustryinfo);
        ExcelUtil<DzbqIndustryinfo> util = new ExcelUtil<DzbqIndustryinfo>(DzbqIndustryinfo.class);
        util.exportExcel(response, list, "行业信息数据");
    }

    /**
     * 获取行业信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:industryinfo:query')")
    @GetMapping(value = "/{industryId}")
    public AjaxResult getInfo(@PathVariable("industryId") Integer industryId)
    {
        return success(dzbqIndustryinfoService.selectDzbqIndustryinfoByIndustryId(industryId));
    }

    /**
     * 新增行业信息
     */
    @PreAuthorize("@ss.hasPermi('system:industryinfo:add')")
    @Log(title = "行业信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DzbqIndustryinfo dzbqIndustryinfo)
    {
        return toAjax(dzbqIndustryinfoService.insertDzbqIndustryinfo(dzbqIndustryinfo));
    }

    /**
     * 修改行业信息
     */
    @PreAuthorize("@ss.hasPermi('system:industryinfo:edit')")
    @Log(title = "行业信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DzbqIndustryinfo dzbqIndustryinfo)
    {
        return toAjax(dzbqIndustryinfoService.updateDzbqIndustryinfo(dzbqIndustryinfo));
    }

    /**
     * 删除行业信息
     */
    @PreAuthorize("@ss.hasPermi('system:industryinfo:remove')")
    @Log(title = "行业信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{industryIds}")
    public AjaxResult remove(@PathVariable Integer[] industryIds)
    {
        return toAjax(dzbqIndustryinfoService.deleteDzbqIndustryinfoByIndustryIds(industryIds));
    }
}
